<div class="page page-current" id="delivery-detail">
    <!-- 标题栏 -->
    <include file="Public:header_back"/>

    <div class="content">
        <div class="card facebook-card">
            <div class="card-header no-border">
                <a href="#">
                    <div class="facebook-avatar">
                        <img src="{$data.order.user.headimgurl}" width="34" height="34">
                    </div>
                    <div class="facebook-name">{$data.order.user.nickname}</div>
                    <div class="facebook-date">{$data.order.user.mobile}</div>
                </a>
            </div>
            <div class="card-content content-padded">
                <p>订单号：{$data.order_id}</p>
                <p>收货人：{$data.order.address.name}</p>
                <p>电话：{$data.order.address.phone}</p>
                <p>
                    地址：{$data.order.address.province}{$data.order.address.city}{$data.order.address.district}{$data.order.address.address}</p>
                <hr>
                <foreach name="data.book" item="vo">
                    <p>《{$vo.sm}》×{$vo.quantity}&nbsp;&nbsp;<span>条码:{$vo.tm}</span></p>
                </foreach>
                <volist name="data.product" id="item">
                    <p>积分兑换： {$item.name}</p>
                </volist>
                <hr>
                <p>会员卡号：{$data.order.user.card_id}</p>
                <p>到期时间：{$data.order.user.expire_time}</p>
            </div>
            <div class="card-footer ">
                <a href="{:U('Delivery/borrow',['user_id'=>$data['order']['user_id']])}" class="link">查看借书</a>
                <eq name="data.state_order" value="2">
                    <a href="#" class="button button-fill button-success" id="doDelivery" data-no-cache="true">确认收货</a>
                </eq>
                <eq name="data.state_order" value="3">
                    <a href="#" class="link color-success">已收货</a>
                </eq>

                <!--<a href="#" class="link">分享</a>-->
            </div>
        </div>
    </div>
</div>
<script>
    $('#delivery-detail #doDelivery').on('click', function () {
        $.showPreloader('确认中')
        $.getJSON("{:U('confirmDelivery',['delivery_id'=>$data['delivery_id']])}", function (result) {
            $.hidePreloader();
            if (result.code == 1) {
                $.alert('确认成功', function () {
                    window.location.href = "{:U('Delivery/detail',['id'=>$data['delivery_id']])}";
                });
            } else {
                $.alert(result.msg);
            }
        });
    });
</script>